home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #5 / Amiga Plus CD - 2000 - No. 5.iso / Tools / Dev / fpc / utilunits / MsgBox.pas < prev    next >
Pascal/Delphi Source File  |  2000-01-01  |  1KB  |  58 lines

  1.  
  2. unit MsgBox;
  3.  
  4. interface
  5.  
  6.  
  7.  
  8. FUNCTION MessageBox(tit,txt,gad:string) : LONGint;
  9. function MessageBox(tit,txt,gad:pchar):longint;
  10.  
  11. implementation
  12.  
  13. uses pastoc;
  14. type
  15.  pEasyStruct = ^tEasyStruct;
  16.    tEasyStruct = record
  17.     es_StructSize   : longint;  { should be sizeof (struct EasyStruct )}
  18.     es_Flags        : longint;  { should be 0 for now                  }
  19.     es_Title        : pchar;   { title of requester window            }
  20.     es_TextFormat   : pchar;   { 'printf' style formatting string     }
  21.     es_GadgetFormat : pchar;   { 'printf' style formatting string   }
  22.    END;
  23.  
  24. FUNCTION EasyRequestArgs(window : pointer; easyStruct : pEasyStruct; idcmpPtr : longint; args : POINTER) : LONGINT;
  25. BEGIN
  26.   ASM
  27.     MOVE.L  A6,-(A7)
  28.     MOVEA.L window,A0
  29.     MOVEA.L easyStruct,A1
  30.     MOVEA.L idcmpPtr,A2
  31.     MOVEA.L args,A3
  32.     MOVEA.L _IntuitionBase,A6
  33.     JSR -588(A6)
  34.     MOVEA.L (A7)+,A6
  35.     MOVE.L  D0,@RESULT
  36.   END;
  37. END;
  38.  
  39. FUNCTION MessageBox(tit,txt,gad:string) : LONGint;
  40. begin
  41.     MessageBox := MessageBox(pas2c(tit),pas2c(txt),pas2c(gad));
  42. end;
  43.  
  44. FUNCTION MessageBox(tit,txt,gad:pchar) : LONGint;
  45. VAR
  46.   MyStruct : tEasyStruct;
  47. BEGIN
  48.  MyStruct.es_StructSize:=SizeOf(tEasyStruct);
  49.  MyStruct.es_Flags:=0;
  50.  MyStruct.es_Title:=(tit);
  51.  MyStruct.es_TextFormat:=(txt);
  52.  MyStruct.es_GadgetFormat:=(gad);
  53.  MessageBox := EasyRequestArgs(nil,@MyStruct,0,NIL);
  54. END;
  55.  
  56. end.
  57.  
  58.